import { defHttp } from '@/utils/http/axios'

enum Api {
  OrganizationTree = '/org/tree',
  DeptTree = '/dept/tree', // 已废弃
  AddOrUpdateDept = '/dept/addOrUpdate',
  DeptPageList = '/dept/pageList',
  DeptDetail = '/dept/detail',
  DeleteDept = '/dept/delete',
}

export const getOrganizationTree = () => defHttp.get({ url: Api.OrganizationTree })
export const getDeptTree = () => defHttp.get({ url: Api.DeptTree })
export const getDeptDetail = (deptId) => defHttp.get({ url: Api.DeptDetail, params: { deptId } })
export const deleteDeptDetail = (deptId) => defHttp.get({ url: Api.DeleteDept, params: { deptId } })
export const addorupdateDept = (data) => defHttp.post({ url: Api.AddOrUpdateDept, data })
export const getDeptPageList = (data) => defHttp.post({ url: Api.DeptPageList, data })
